import React, { Component } from "react";
import $ from 'jquery';
import {
    recursionGetValue,
    recursionSetValue
} from "../../../util/public";
import fetch from "../../../util/fetch";
import { message } from "antd";
const GetTeacherStu = "/api/Contact";

class ChatGroupOne extends Component {
    constructor(props) {
        super(props);
        this.state = {
            childVisible: false,
            childListType: "group",
            listType: {
                1: "lastly",
                3: "frequently",
                5: "class",
                9: "group",
                7: "all",
                11: "chatGroup",
                13: "parent",
                15: "admin",
                17: "organization"
            },
            organizationList: [],
            childList: [],
            historyClick: [],
            allChildList: [],
            allChildInfo: [],
            organizationMemList: []
        };
    }
    componentDidMount() {
        //   this.getChildList();
    }
    getChildList = (level = 0, levelID = "", groupID = "", nextLastLevelFlag = 0, allData = "", callback, e) => {
        //获取各个子列表的内容
        if (e && $(e.target).attr('class') &&
            $(e.target).attr('class').indexOf('leftlogo') === -1 &&
            $(e.target).attr('class').indexOf('logo') !== -1) {
            return;
        }
        let {
            data,
            selectUserList,
            isCheck
        } = this.props;
        if (isCheck && allData.GroupName === "全校学生") {
            message.warn("学生不能作为转交对象");
            return;
        }
        let SchoolID = sessionStorage.getItem("schoolId");
        let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
        let UserID = userInfo.UserID;
        let UserType = userInfo.UserType;
        let UserCurrentIdentity = {};
        let SchoolLevel = "S" + sessionStorage.getItem("schoolType");
        let {
            historyClick,
            allChildInfo,
            organizationList,
            allChildList
        } = this.state;
        let url = "";

        if ((level && allData) || allData.value || allData.IdentityID || allData.FullPathID) { //更新历史点击记录
            if (allData.value) {
                historyClick = [];
                historyClick.push(allData.GroupName || allData.title); //会直接同步更新state
            } else {
                historyClick.push(allData.GroupName || allData.DepartmentName);
            }
        }
        let sign = 0;
        //若已保存了用户列表，则不再请求接口获取
        allChildInfo.forEach((item) => {
            if (groupID && !allData.FullPathID && item.id === groupID) {
                sign = 1;
                this.setState({
                    childList: item.userList
                })
            }
            if (allData.IdentityID && item.id === allData.IdentityID) {
                sign = 1;
                this.setState({
                    childList: item.userList
                })
            }
            // if(allData.FullPathID && item.id === allData.FullPathID){
            //     sign = 1;
            //     this.setState({
            //         childList: item.userList
            //     })
            // }
        })
        console.log(allChildInfo, allData)
        if (sign == 1) {

            return;
        }
        console.log(allData)
        if (data.value == 1) {
            url = GetTeacherStu +
                "/GetRecentContactList?SchoolLevel=" + SchoolLevel;
        }
        if (data.value == 3) {
            url = GetTeacherStu +
                "/GetFrequentContactList?schoollevel=" + SchoolLevel;
        }
        if (data.value == 5) {
            url = GetTeacherStu +
                "/GetMyClassList?schoollevel=" + SchoolLevel +
                "&SchoolID=" + SchoolID +
                "&UserID=" + UserID +
                "&UserType=" + UserType +
                "&GradeID=&GradeName=";
        }
        if (data.value == 7) {
            url = GetTeacherStu +
                "/GetAllSchoolList?schoollevel=" + SchoolLevel +
                "&level=" + level +
                "&nextislastlevelflag=" + nextLastLevelFlag +
                "&levelid=" + levelID +
                "&groupid=" + groupID;
        }
        if (data.value == 9) {
            url = GetTeacherStu +
                "/GetMyTeacherGroupList?SchoolLevel=" + SchoolLevel +
                "&level=" + level +
                "&nextislastlevelflag=" + nextLastLevelFlag +
                "&levelid=" + levelID +
                "&groupid=" + groupID;
        }
        if (data.value == 13) {
            url = GetTeacherStu +
                "/GetStuParentClassList?SchoolLevel=" + SchoolLevel +
                "&gradeid=&gradename=";
        }
        if (data.value == 15 && data.id === "admin") { //管理员
            //http://IP:Port/api/Contact/GetAllAdminIdentity?schoollevel=S2&schoolID=
            // url = GetTeacherStu +
            // "/GetAdminContactList?SchoolLevel=" + SchoolLevel;
            url = GetTeacherStu +
                "/GetAllAdminIdentity?SchoolLevel=" + SchoolLevel + "&schoolID=" + SchoolID;
        }
        if (allData.IdentityCode) {
            //http://IP:Port/api/Contact/GetAdminMember?schoollevel=S2&schoolID=&IdentityCode=
            url = GetTeacherStu +
                "/GetAdminMember?SchoolLevel=" + SchoolLevel + "&schoolID=" + SchoolID + "&IdentityCode=" + allData.IdentityCode;
        }
        if (data.value == 17) {
            url = GetTeacherStu +
                "/GetOrganizationInfo?SchoolLevel=" + SchoolLevel + "&schoolID=" + SchoolID;
        }
        if (allData.DepartmentID && !allData.IsLast) {
            //组织结构需要从存储中取
            let child = recursionGetValue(organizationList, allData.FullPathID, "FullPathID", "Children");
            let end = [];
            Array.isArray(child) &&
                child.forEach((item) => {
                    end.push({
                        GroupID: item.FullPathID,
                        GroupName: item.DepartmentName,
                        ...item
                    })
                })
            allChildList[allData.level] = end;
            this.getOrganizationMem(allData);
            this.setState({
                childList: end,
                allChildList,
                historyClick
            }, () => {
                callback && callback();
            })
            return;
        }
        if (allData.DepartmentID && allData.IsLast) {
            url = GetTeacherStu +
                "/GetDepartmentMember?schoolLevel=" + SchoolLevel + "&schoolID=" + SchoolID + "&departmentID=" + allData.DepartmentID;
        }
        if (allData.ClassID) { //获取班级成员
            let classMemberType = allData.classMemberType ? allData.classMemberType : 2;
            if (UsercurrentIdentity.identityCode === "IC0014") {
                url = GetTeacherStu +
                    "/GetStuClassMemberList?classid=" + allData.ClassID +
                    "&classtype=" + allData.ClassType +
                    "&classmembertype=" + classMemberType +
                    "&schoollevel=" + SchoolLevel;

            } else {
                url = GetTeacherStu +
                    "/GetClassMemberList?SchoolLevel=" + SchoolLevel +
                    "&ClassID=" + allData.ClassID +
                    "&ClassType=" + allData.ClassType +
                    "&ClassMemberType=" + classMemberType;
            }
        }
        fetch
            .getWork({ url })
            .then((res) => {
                return res.json();
            })
            .then((result) => {
                console.log(result);
                if (result.StatusCode == 200 && result.Data) {
                    if (data.value == 13) { //添加家长标示，区别获取家长列表还是学生列表
                        result.Data.forEach((item) => {
                            item.classMemberType = 3;
                        })
                    }
                    //学校管理员特殊处理
                    if (data.value == 15) {
                        result.Data.forEach((item) => {
                            item.GroupName = item.IdentityName === "学校管理员" ? "超级管理员" : item.IdentityName;
                            item.GroupID = item.IdentityID;
                        })
                    }
                    if (data.value == 17 && !allData.IsLast) {
                        if (Array.isArray(result.Data.Tree)) {
                            result.Data.Tree.forEach((item) => {
                                item.GroupName = item.DepartmentName;
                                item.GroupID = item.FullPathID;
                            })
                            result.Data = recursionSetValue(result.Data.Tree, "level", 1);
                            //因为组织结构是一次性获取所有目录结构，所以存储起来，之后子列表的结构就从存储的目录里拿
                            this.setState({
                                organizationList: result.Data
                            })
                        }

                    }
                    if (allData.DepartmentID && allData.IsLast) {  //组织结构最后一项
                        result.Data = result.Data && Array.isArray(result.Data.List) ? result.Data.List : [];
                    }
                    if (allData.IdentityCode) {
                        result.Data = result.Data[0];
                    }
                    if (allData.ClassID && UsercurrentIdentity.identityCode === "IC0014") {
                        result.Data = Array.isArray(result.Data.TeacherList) ?
                            result.Data.TeacherList.concat(result.Data.StudentList) :
                            result.Data.StudentList;
                    }
                    //保存各个子列表内的用户数据，用于判断该列表的选择状态
                    Array.isArray(result.Data) && result.Data.forEach((item) => {

                        this.saveChildList(item.Level, item.LevelID, item.GroupID, item.NextIsLastLevelFlag, item);
                    })
                    //记录历史点击的各个层级数据
                    allChildList[(level ? level : allData.level ? allData.level : 0)] = result.Data;
                    this.setState({
                        childList: result.Data,
                        allChildList: allChildList,
                        historyClick
                    }, () => {
                        callback && callback();
                    })
                    // } else {
                    //     this.setState({

                    //     })
                    // }
                } else {

                }

            })
    }
    saveChildList = (level = 0, levelID = "", groupID = "", nextLastLevelFlag = 0, allData = "") => {
        //记录各个子列表的用户

        let {
            data,
        } = this.props;
        let SchoolID = sessionStorage.getItem("schoolId");
        let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
        let UserID = userInfo.UserID;
        let UserType = userInfo.UserType;
        let UserCurrentIdentity = {};
        let SchoolLevel = "S" + sessionStorage.getItem("schoolType");
        let {
            historyClick,
            allChildInfo,
            organizationList
        } = this.state;
        if (!nextLastLevelFlag && !allData.ClassID && allData.id !== "admin" && !allData.IdentityID && allData.id !== "organization" && !allData.FullPathID) {
            return;
        }
        let url = "";
        if (data.value == 1) {
            url = GetTeacherStu +
                "/GetRecentContactList?SchoolLevel=" + SchoolLevel;
        }
        if (data.value == 3) {
            url = GetTeacherStu +
                "/GetFrequentContactList?schoollevel=" + SchoolLevel;
        }
        if (data.value == 5) {
            url = GetTeacherStu +
                "/GetRecentContactList?SchoolLevel=" + SchoolLevel;
        }
        if (data.value == 7) {
            url = GetTeacherStu +
                "/GetAllSchoolList?schoollevel=" + SchoolLevel +
                "&level=" + level +
                "&nextislastlevelflag=" + nextLastLevelFlag +
                "&levelid=" + levelID +
                "&groupid=" + groupID;
        }
        if (data.value == 9) {
            url = GetTeacherStu +
                "/GetMyTeacherGroupList?SchoolLevel=" + SchoolLevel +
                "&level=" + level +
                "&nextislastlevelflag=" + nextLastLevelFlag +
                "&levelid=" + levelID +
                "&groupid=" + groupID;
        }
        if (data.value == 13) {
            url = GetTeacherStu +
                "/GetStuParentClassList?SchoolLevel=" + SchoolLevel +
                "&gradeid=&gradename=";
        }
        if (data.value == 15 && data.id === "admin") { //管理员
            //http://IP:Port/api/Contact/GetAllAdminIdentity?schoollevel=S2&schoolID=
            // url = GetTeacherStu +
            // "/GetAdminContactList?SchoolLevel=" + SchoolLevel;
            url = GetTeacherStu +
                "/GetAllAdminIdentity?SchoolLevel=" + SchoolLevel + "&schoolID=" + SchoolID;
        }
        if (allData.IdentityCode) {
            //http://IP:Port/api/Contact/GetAdminMember?schoollevel=S2&schoolID=&IdentityCode=
            url = GetTeacherStu +
                "/GetAdminMember?SchoolLevel=" + SchoolLevel + "&schoolID=" + SchoolID + "&IdentityCode=" + allData.IdentityCode;
        }
        if (data.value == 17) {
            url = GetTeacherStu +
                "/GetOrganizationInfo?SchoolLevel=" + SchoolLevel + "&schoolID=" + SchoolID;
        }
        if (allData.DepartmentID && !allData.IsLast) {
            //组织结构需要从存储中取
            let child = recursionGetValue(organizationList, allData.FullPathID, "FullPathID", "Children");
            let end = [];
            Array.isArray(child) &&
                child.forEach((item) => {
                    end.push({
                        GroupID: item.FullPathID,
                        GroupName: item.DepartmentName,
                        ...item
                    })
                })
            allChildInfo.push({
                id: allData.FullPathID,
                userList: end
            });
            this.setState({
                allChildInfo
            })
            return;
        }
        if (allData.DepartmentID && allData.IsLast) {
            url = GetTeacherStu +
                "/GetDepartmentMember?schoolLevel=" + SchoolLevel + "&schoolID=" + SchoolID + "&departmentID=" + allData.DepartmentID;
        }
        if (allData.ClassID) {
            let classMemberType = allData.classMemberType ? allData.classMemberType : 2;
            if (UsercurrentIdentity.identityCode === "IC0014") {
                url = GetTeacherStu +
                    "/GetStuClassMemberList?classid=" + allData.ClassID +
                    "&classtype=" + allData.ClassType +
                    "&classmembertype=" + classMemberType +
                    "&schoollevel=" + SchoolLevel;

            } else {
                url = GetTeacherStu +
                    "/GetClassMemberList?SchoolLevel=" + SchoolLevel +
                    "&ClassID=" + allData.ClassID +
                    "&ClassType=" + allData.ClassType +
                    "&ClassMemberType=" + classMemberType;
            }

        }
        fetch
            .getWork({ url })
            .then((res) => {
                return res.json();
            })
            .then((result) => {
                if (result.StatusCode == 200 && result.Data) {
                    // if(result.Data.length > 0){
                    //保存各个子列表内的用户数据，用于判断该列表的选择状态
                    // if(data.value == 13){ //添加家长标示，区别获取家长列表还是学生列表
                    //     result.Data.forEach((item)=>{
                    //         item.classMemberType = 3;
                    //     })
                    // }
                    if (allData.ClassID && UsercurrentIdentity.identityCode === "IC0014") {
                        result.Data = Array.isArray(result.Data.TeacherList) ?
                            result.Data.TeacherList.concat(result.Data.StudentList) :
                            result.Data.StudentList;
                    }
                    if (allData.IsLast) {  //组织结构最后一项
                        result.Data = Array.isArray(result.Data.List) ? result.Data.List : [];
                    }
                    allChildInfo.push({
                        id: groupID || allData.ClassID || allData.IdentityID || allData.FullPathID,
                        userList: allData.IdentityID ? result.Data[0] : result.Data
                    });
                    this.setState({
                        allChildInfo
                    })
                }

            })
    }
    showChild = (e) => {
        //防止事件冒泡

        if (!$(e.target).attr('class') ||
            ($(e.target).attr('class') && $(e.target).attr('class').indexOf("group-one") === -1)) {
            return;
        }
        let {
            childVisible
        } = this.state;
        let {
            data
        } = this.props;
        if (!childVisible) {
            this.getChildList(0, '', '', 0, data, () => {

            });
        } else {
            this.setState({
                childList: [],
                historyClick: [],
                allChildList: []
            })
        }
        //列表下拉图标旋转
        if (childVisible) {
            $(e.target).children(".downlogo").css({
                transform: ""
            })
            if (data.value == 7) {
                $(e.target).css({
                    borderBottom: '1px solid #ebebeb'
                })
            }

        } else {
            $(e.target).children(".downlogo").css({
                transform: "rotate(180deg)"
            })
            if (data.value == 7) {
                $(e.target).css({
                    borderBottom: 0
                })
            }

        }
        this.setState({
            childVisible: !childVisible
        })
    }
    getOrganizationMem = (allData) => {
        let SchoolID = sessionStorage.getItem("schoolId");
        let userInfo = JSON.parse(sessionStorage.getItem("userInfo"));
        let UserID = userInfo.UserID;
        let UserType = userInfo.UserType;
        let UserCurrentIdentity = {};
        let SchoolLevel = sessionStorage.getItem("schoolLevel");
        let url = GetTeacherStu +
            "/GetDepartmentMember?schoolLevel=" + SchoolLevel + "&schoolID=" + SchoolID + "&departmentID=" + allData.DepartmentID;
        fetch
            .getWork({ url })
            .then((res) => {
                return res.json();
            })
            .then((result) => {
                console.log(result);
                if (result.StatusCode == 200 && result.Data) {
                    this.setState({
                        organizationMemList: result.Data.List
                    })
                }
            });
    }
    selectUser = (data, type, e, e1) => {
        //选择或取消用户,type: 1表示单个操作，2表示多个操作
        let {
            unselectList
        } = this.props;
        if (["1", "2", "0", 0, 1, 2].includes(e)) {
            e1.preventDefault();
            if (unselectList.includes(data.UserID)) {
                message.warn("该用户已经在审批人列表中，无法转交");
                return;
            }
            if (e == 2) {
                this.props.selectUser(data, type, "delete");
            } else {
                this.props.selectUser(data, type, "add");
            }
            return;
        }
        if (!$(e.target).attr('class')) {
            return;
        }
        e.stopPropagation();
        if (unselectList.includes(data.UserID)) {
            message.warn("该用户已经在审批人列表中，无法转交");
            return;
        }
        if ($(e.target).attr('class').indexOf("checklogo") !== -1) { //未选项
            this.props.selectUser(data, type, "add");
        } else { //已选项
            this.props.selectUser(data, type, "delete");
        }

    }
    historyChoose = (history) => {
        //点击历史点击记录
        let {
            data
        } = this.props;
        let {
            allChildList,
            historyClick
        } = this.state;
        let childList = [];
        //获取需要回到的层级数据
        if (data.title === history) {
            //   childList = oneChildList;
            childList = allChildList[0];
        }
        console.log(allChildList)
        childList.length === 0 &&
            allChildList.forEach((item, index) => {
                item.forEach((child) => {
                    if (child.GroupName === history) {
                        console.log(index, history, child, allChildList)
                        if (child.FullPathID) {
                            childList = allChildList[index + 1];
                        } else {
                            childList = allChildList[index + 1];
                        }


                    }
                })
            })
        //删除选择记录之后的点击记录
        let targetIndex;
        historyClick.forEach((item, index) => {
            if (item === history) {
                targetIndex = index;
            }
        })
        historyClick.splice(targetIndex + 1);

        this.setState({
            childList,
            historyClick
        })
    }
    selectGroup = (groupID, e) => {
        //全选/取消分组选择
        e.preventDefault();
        if (!$(e.target).attr('class') || ($(e.target).attr('class') && $(e.target).attr('class').indexOf('logo') == -1)) {
            return;
        }
        let {
            allChildInfo
        } = this.state;
        console.log(allChildInfo, groupID);
        let sign = 0;
        allChildInfo.forEach((item) => {
            if (item.id === groupID) {
                sign = 1;
                if ($(e.target).attr('class').indexOf("checklogo") !== -1) { //未选项
                    if (!item.userList.length) {
                        message.warn("当前分组没有成员，无法选择");
                    }
                    this.props.selectUser(item.userList, 2, "add");
                } else { //已选项
                    this.props.selectUser(item.userList, 2, "delete");
                }
            }
        })
    }
    render() {
        let {
            data,
            selectUserList,
            isCheck,
            unselectList,
            noMe
        } = this.props;
        let {
            childVisible,
            listType,
            childList,
            historyClick,
            allChildInfo,
            organizationMemList
        } = this.state;
        let userSelectCount = 0;
        let userSelectSign = "checklogo";
        //将已选的用户标志为已选
        //0表示未选，2表示已选
        if (childList[0] && childList[0].UserID) {
            childList.forEach((item) => {
                item.checkSign = 1;
                selectUserList.forEach((child) => {
                    if (item.UserID === child.UserID) {
                        item.checkSign = 2;
                        userSelectCount++;
                    }
                })
            })
        }
        //给全选按钮添加选择状态
        if (userSelectCount == 0) {
            userSelectSign = "checklogo";
        }
        if (userSelectCount > 0 && userSelectCount < childList.length) {
            userSelectSign = "helflogo";
        }
        if (userSelectCount == childList.length) {
            userSelectSign = "checkedlogo";
        }
        //给分组添加选择标志
        //0表示未选，1表示半选，2表示已选
        if (childList[0] && (childList[0].GroupID || childList[0].ClassID)) {
            allChildInfo.forEach((item) => {
                childList.forEach((child) => {
                    if (child.GroupID === item.id || child.ClassID === item.id) {
                        let count = 0;
                        item.userList.forEach((user) => {
                            selectUserList.forEach((selectUser) => {
                                if (user.UserID === selectUser.UserID) {
                                    count++;
                                }
                            })
                            if (count > 0 && count < item.userList.length) {
                                child.checkSign = 1;
                            }
                            if (count == 0) {
                                child.checkSign = 0;
                            }
                            if (count == item.userList.length) {
                                child.checkSign = 2;
                            }
                        })
                    }
                })
            })
        }
        return (
            <li className="group-one" onClick={this.showChild}>
                <i className={"contactlogo " + listType[data.value]}></i>
                {data.title}
                <i className="downlogo"></i>
                {
                    [1, 3].includes(data.value) ?
                        <ul className="list-content-user" style={{ display: (childVisible ? "block" : "none") }}>
                            {
                                childList.length > 0 ?
                                    <li>
                                        <i className={userSelectSign} onClick={(e) => this.selectUser(childList, 2, e)}></i>
                                        全选
                                    </li> :
                                    ""
                            }
                            {
                                childList.length > 0 ?
                                    childList.map((item, index) => {
                                        return (
                                            <li key={index} title={item.UserName + "(" + item.UserID + ")"}>
                                                <i
                                                    className={item.checkSign == 2 ? "checkedlogo" : "checklogo"}
                                                    onClick={(e) => this.selectUser(item, 1, e)}></i>
                                                {item.UserName}
                                                <span style={{ color: '#999999' }}>({item.UserID})</span>
                                                {/* <i className="leftlogo"></i> */}
                                            </li>
                                        )
                                    }) :
                                    <p style={{ height: 60, lineHeight: '50px', textAlign: 'center', color: '#999' }}>暂无可选人员</p>
                            }
                        </ul> :
                        [5, 7, 9, 13, 15, 17].includes(data.value) ?
                            <ul className="list-content-group" style={{ display: (childVisible ? "block" : "none") }}>
                                {
                                    // childList[0] && (childList[0].Level > 1 || childList[0].UserID) && 
                                    historyClick.length > 1 ?
                                        <p className="history-router">
                                            {
                                                historyClick.map((item, index) => {
                                                    return (
                                                        <span
                                                            key={index}
                                                            className="router-one"
                                                            onClick={
                                                                index === historyClick.length - 1 ?
                                                                    () => { } :
                                                                    () => this.historyChoose(item)
                                                            }>
                                                            <span>{item}</span>
                                                            {
                                                                index === historyClick.length - 1 ?
                                                                    "" :
                                                                    "/"
                                                            }
                                                        </span>
                                                    )
                                                })
                                            }
                                        </p> :
                                        ""
                                }
                                {
                                    childList[0] && (childList[0].DataType == 7 || childList[0].UserID) ?
                                        <li>
                                            <i className={userSelectSign} onClick={(e) => this.selectUser(childList, 2, e)}></i>
                                            全选
                                        </li> :
                                        ""
                                }
                                {
                                    childList.length > 0 ?
                                        childList.map((item, index) => {
                                            //审核人隐藏学生
                                            if (isCheck && (item.UserType == 2 || item.UserType == 3)) {
                                                return;
                                            }
                                            if (item.userType == 2 || item.userType == 3) {
                                                return;
                                            }
                                            if (noMe && item.UserID === sessionStorage.getItem("userId")) {
                                                return;
                                            }
                                            return (
                                                <li
                                                    key={index}
                                                    onClick={
                                                        item.DataType != 7 && !item.UserID ?
                                                            (e) => this.getChildList(item.Level, item.LevelID, item.GroupID, item.NextIsLastLevelFlag, item, '', e) :
                                                            (e) => this.selectUser(item, 1, item.checkSign, e)
                                                    }
                                                    title={
                                                        item.DataType == 7 || item.UserID ?
                                                            item.UserName + "(" + item.UserID + ")" :
                                                            ""}
                                                    className={data.value == 7 && item.DataType == 13 ? `second-menu ${unselectList.includes(item.UserID) || (isCheck && item.GroupName === "全校学生") ? "disable" : ""}` : `${unselectList.includes(item.UserID) || (isCheck && item.GroupName === "全校学生") ? "disable" : ""}`}
                                                >
                                                    {
                                                        // item.DataType !== 13 && item.DataType !== 1?
                                                        item.NextIsLastLevelFlag || item.UserID || item.ClassID || item.IdentityID ?
                                                            <i className={
                                                                item.DataType !== 7 && !item.UserID ?
                                                                    item.checkSign == 1 ?
                                                                        "helflogo" :
                                                                        item.checkSign == 2 ?
                                                                            "checkedlogo" :
                                                                            "checklogo" :
                                                                    item.checkSign == 2 ?
                                                                        "checkedlogo" :
                                                                        "checklogo"
                                                            } onClick={item.DataType === 7 || item.UserID ? (e) => this.selectUser(item, 1, e) :
                                                                (e) => this.selectGroup(item.GroupID || item.ClassID, e)}></i> :
                                                            ""
                                                    }
                                                    {
                                                        item.UserID ?
                                                            <div className="user_header" style={{ backgroundImage: `url('${item.PhotoPath}')` }}></div> :
                                                            ""
                                                    }
                                                    <span
                                                        className={item.NextIsLastLevelFlag || item.UserID || item.ClassID ? "" : "child-name"}
                                                    >
                                                        {item.GroupName || item.ClassName || item.UserName}
                                                    </span>
                                                    {
                                                        item.DataType == 7 || item.UserID ?
                                                            <span style={{ color: '#999999' }}>({item.UserID})</span> :
                                                            <span className="next-floor"><i className="leftlogo"></i>下级</span>
                                                    }
                                                </li>
                                            )
                                        }) :
                                        <p style={{ height: 60, lineHeight: '50px', textAlign: 'center', color: '#999' }}>暂无可选人员</p>
                                    // <Empty
                                    // title={"无可选人员"}
                                    // type={"4"}
                                    // style={{marginTop: 50 + 'px', paddingBottom: 20}}
                                    // ></Empty>
                                }
                                {
                                    organizationMemList.map((item, index) => {
                                        let sign = 0;
                                        selectUserList.forEach((child) => {
                                            if (child.UserID === item.UserID) {
                                                sign = 2;
                                            }
                                        })
                                        return (
                                            <li
                                                key={index}
                                                title={item.UserName + "(" + item.UserID + ")"}
                                                className={unselectList.includes(item.UserID) ? "disable" : ""}
                                                onClick={(e) => this.selectUser(item, 1, sign, e)}>
                                                <i
                                                    className={sign ? "checkedlogo" : "checklogo"}
                                                    onClick={(e) => this.selectUser(item, 1, e)}></i>
                                                {item.UserName}
                                                <span style={{ color: '#999999' }}>({item.UserID})</span>
                                                {/* <i className="leftlogo"></i> */}
                                            </li>
                                        )
                                    })
                                }
                            </ul> :
                            ""
                }
            </li>
        )
    }
}
export default ChatGroupOne;
